import Vue from 'vue'
import App from './App.vue'
import {
  Form,
  Input,
  FormItem,
  Button,
  TableColumn,
  Table,
  Header,
  Container,
  Main,
  Footer,
  Aside,
  Upload,
  TimePicker,
  Pagination,
  Dialog,
  Submenu,
  Menu,
  MenuItemGroup,
  MenuItem,

} from 'element-ui'
import axios from 'axios';
const components = [
  Upload, Form, Input, FormItem, Button, TableColumn, Table, Header, Container, Main, Footer, Aside,
  TimePicker, Pagination, Dialog, Submenu, Menu, MenuItemGroup, MenuItem
];


// 循环注册组件
components.forEach(component => {
  Vue.use(component);
});


//引入路由
import router from './router'
import plugins from './plugins';
Vue.use(plugins)
Vue.config.productionTip = false
// 请求拦截器
//main.js
axios.interceptors.request.use(
  (config) => {
    console.log('请求拦截器')
    const token = localStorage.getItem('token');
    const userid = localStorage.getItem('userid');
    if (token) {
      config.headers.token = `${token}`;
      config.headers.userid = `${userid}`;
    }
    return config;
  },
);
Vue.prototype.$axios = axios;
new Vue({
  render: h => h(App),
  router,
}).$mount('#app')





